package com.cs;

import java.nio.IntBuffer;

/**
 * @ClassName: BasicBuffer
 * @Description: TODO
 * @Author: kevinHan
 * @Date: 2020/8/6 20:59
 * @Version: 1.0
 */
public class BasicBuffer {
    public static void main(String[] args) {
        IntBuffer buffer = IntBuffer.allocate(5);

        for (int i = 0; i < buffer.capacity(); i++) {
            System.out.println( i * 2 );
        }

        buffer.flip();
        while (buffer.hasRemaining()) {
            System.out.println(buffer.get());
        }
    }
}
